#ifndef _LOGGER_H__
#define _LOGGER_H__
#include <iostream>
#define INF 0
#define DBG 1
#define ERR 2
#define DEFAULT_LOG_LEVEL INF
#define LOG(level, format, ...)                                                            \
    do                                                                                     \
    {                                                                                      \
        if (level < DEFAULT_LOG_LEVEL)                                                     \
            break;                                                                         \
        time_t t = time(NULL);                                                             \
        struct tm *tm = localtime(&t);                                                     \
        char buf[20];                                                                      \
        strftime(buf, 19, "%H:%M:%S", tm);                                                 \
        fprintf(stdout, "[%s %s:%d] " format "\n", buf, __FILE__, __LINE__, ##__VA_ARGS__); \
    } while (0)
#define ILOG(format, ...) LOG(INF, format, ##__VA_ARGS__)
#define DLOG(format, ...) LOG(DBG, format, ##__VA_ARGS__)
#define ELOG(format, ...) LOG(ERR, format, ##__VA_ARGS__)
#endif